package com.ys.web.security;

import java.util.HashMap;
import java.util.Map;

import com.ys.web.pojo.SystemPermissonInfo;

/**
 * systeminfo map for store systeminfo
 * @author goldfish
 *
 */
public class SystemPermissionUtils {

	/**
	 * username be a key and system permission for a object 
	 */
	private static final Map<String,SystemPermissonInfo> systemInfoMap = new HashMap<String,SystemPermissonInfo>();

	/**
	 * username be key and add a permisson object
	 */
	public static void addUserPermission(String username,SystemPermissonInfo systemPermissonInfo){
		if(!systemInfoMap.containsKey(username)){
			systemInfoMap.put(username, systemPermissonInfo);
		}
	}
	
	/**
	 * 通过用户名获取系统属情
	 * @param username
	 * @return
	 */
	public static SystemPermissonInfo getUserPermission(String username){
		return systemInfoMap.get(username);
	}
	
	/**
	 * remove username object 
	 */
	public static void removeUserPermission(String username){
		systemInfoMap.remove(username);
	}
}
